package com.example.tijianserver.controller;

import com.example.tijianserver.pojo.Hospital;
import com.example.tijianserver.response.ApiRestResponse;
import com.example.tijianserver.service.HospitalsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController  // @Controller  +  @ResponseBody
@RequestMapping("/hospital")
public class HospitalsController {

    @Autowired
    HospitalsService hospitalsService;

    @RequestMapping("/list")
    public ApiRestResponse listHospitals(@RequestBody Hospital hospital){

        return ApiRestResponse.success(hospitalsService.listHospital(hospital));
    }

    @RequestMapping("/getHospitalById")
    public ApiRestResponse getHospitalById(@RequestBody Hospital hospital){

        return ApiRestResponse.success(hospitalsService.getHospitalById(hospital));
    }

}
